import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    //在地址为空时，直接跳转cell路由
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/Home"),
    meta: { isShow: true, isTopbar: false }
  },
  {
    path: "/cart",
    name: "cart",
    component: () => import("@/views/Cart"),
    meta: { isShow: false, isTopbar: true ,title: "购物车", toHere: "my"},
    // props: { title: "购物车", toHere: "my" }

  },
  {
    path: "/my",
    name: "my",
    component: () => import("@/views/My"),
    meta: { isShow: true, isTopbar: false }

  },
  {
    path: "/address",
    name: "address",
    component: () => import("@/components/publicComponents/address"),
    meta: { isShow: false, isTopbar: true, title: "收货地址", toHere: "cart" },
    // props: { title: "收货地址", toHere: "cart" }
  },
  {
    path: "/category",
    name: "category",
    component: () => import("@/views/Category"),
    meta: { isShow: true, isTopbar: false }

  },
  {
    path: "/register",
    name: "register",
    component: () => import("@/views/register"),
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login"),
  },
];

const router = new VueRouter({
  routes,
});

export default router;
